﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width" />
    <title>生产管理粗纱机</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <script src="../Content/scripts/jquery-1.11.1.min.js"></script>
    <link href="../Content/styles/font-awesome.min.css" rel="stylesheet" />
    <link href="../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jquery-ui/jquery-ui.min.js"></script>
    <link href="../Content/scripts/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <script src="../Content/scripts/bootstrap/bootstrap.min.js"></script>
    <link href="../Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
    <link href="../Content/adminLTE/css/index.css" rel="stylesheet" />
    <link href="../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <script src="../Content/scripts/plugins/tree/tree.js"></script>
    <script src="../Content/scripts/plugins/validator/validator.js"></script>
    <script src="../Content/scripts/plugins/dialog/dialog.js"></script>
    <script src="../Content/scripts/utils/learun-ui.js"></script>
    <script src="../Content/scripts/utils/learun-form.js"></script>
    <link href="../Content/scripts/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/bootstrap-table/bootstrap-table.js"></script>
    <script src="../Content/scripts/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <script src="../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../My97DatePicker/WdatePicker.js"></script>
    <script src="../js/highcharts.js"></script>
    <script src="../js/highcharts-3d.js"></script>
    <script src="../js/getUrlParam.js"></script>

    <script src="CustomerMFGJS.js"></script>
    <style type="text/css">
        body {
            margin: 0px;
            margin-top: 10px;
        }

        .form .formTitle {
            width: 130px;
            font-size: 20px;
            padding-bottom: 35px;
        }

        .form .formValue {
            padding-bottom: 25px;
            width: 170px;
        }

        .valuestyle {
            font-size: 20px;
        }

        #title {
            font-size: 30px;
            text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
        }

        #time {
            font-size: 20px;
            float: right;
            line-height: 50px;
            right: 40px;
            position: fixed;
            color: #65b540;
        }

        @media screen and (min-width:1281px) and (max-width:1440px) {
            .valuestyle {
                font-size: 15px;
            }

            .form .formTitle {
                font-size: 15px;
            }
        }

        #info {
            float: right;
            color: #ff0000;
            font-size: 9px;
        }

        a {
            color: skyblue;
            text-decoration: none;
            cursor: pointer;
        }

        span {
            border-radius: 100px;
        }

        .highcharts-subtitle {
            left: 260px;
        }

            .highcharts-subtitle a {
                font-size: 20px;
            }
    </style>
</head>

<body>
    <div style="text-align: center; height: 50px;">
        <span id="title"></span>
        <span id="time"></span>
    </div>
    <!--粗纱实时数据-->

    <div class="panel-Title">粗纱实时报警信息</div>
    <div class="titlePanel" id="customerselect">
        <div class="title-search">
            <table>
                <tr>
                    <td style="padding-left: 5px;">
                        <span>客户名称：</span>
                    </td>
                    <td style="padding-left: 5px;">
                        <select class="form-control" id="customerlist" style="width: 200px;"></select>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <table id="tb_cushaalarm"></table>

    <script>
        setInterval(function () {
            fnDate();
        }, 1000);

        console.log(getCookie("CustomerID"));

        $(function () {
            if (getCookie("CustomerID") !== "") {
                $("#customerselect").css('display', 'none');
                $("#title").html(getCookie("CustomerName") + "报警信息");
                $.CustomerMFGjs.initAlarmInfo(getCookie("CustomerID"));
            }
            else {
                $.CustomerMFGjs.getCustomerList();

                $("#title").html($('#customerlist').find('option:selected').text() + "报警信息");
                $.CustomerMFGjs.initAlarmInfo($('#customerlist').find('option:selected').text());

                $('#customerlist').on('change', function () {
                    //判断是否选取prompt属性，无返回值；
                    if ($(this).val()) {
                        $("#title").html($('#customerlist').find('option:selected').text() + "报警信息");
                        //$.CustomerMFGjs.initAlarmInfo($('#customerlist').find('option:selected').text());

                        $("#tb_cushaalarm").jqGrid('setGridParam', {
                            postData: {
                                Action: "initAlarmInfo",
                                CustomerID: $('#customerlist').find('option:selected').text()
                            },
                        }).trigger('reloadGrid');
                    }
                });

            }
        })

        //js 获取当前时间
        function fnDate() {
            var oDiv = document.getElementById("time");
            var date = new Date();
            var year = date.getFullYear();//当前年份
            var month = date.getMonth();//当前月份
            var data = date.getDate();//天
            var hours = date.getHours();//小时
            var minute = date.getMinutes();//分
            var second = date.getSeconds();//秒
            var time = year + "-" + fnW((month + 1)) + "-" + fnW(data) + " " + fnW(hours) + ":" + fnW(minute) + ":" + fnW(second);
            oDiv.innerHTML = time;
        }


        //补位 当某个字段不是两位数时补0
        function fnW(str) {
            var num;
            str > 9 ? num = str : num = "0" + str;
            return num;
        }

        //读取cookie
        function getCookie(name) {
            var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
            if (arr != null) return decodeURI(arr[2]); return null;
        };
    </script>
</body>

</html>
